package com.hmsm.sys.bean;

import java.util.HashSet;
import java.util.Set;

public class RTXUserBean {

	private static int nextId = -1;
	
	private int id;
	private String relevanceId;
	private String userName;
	private String name;
	private String mobile;
	private String email;
	private Integer flag;
	private String position;
	private RTXDeptBean depart;
	
	public RTXDeptBean getDepart() {
		return depart;
	}

	public void setDepart(RTXDeptBean depart) {
		this.depart = depart;
	}

	private Set<RTXDeptBean> userDepts = new HashSet<RTXDeptBean>();
	
	public Set<RTXDeptBean> getUserDepts() {
		return userDepts;
	}

	public void setUserDepts(Set<RTXDeptBean> userDepts) {
		this.userDepts = userDepts;
	}

	private LocalUser bindUser;		// 绑定的本地用户

	public LocalUser getBindUser() {
		return bindUser;
	}

	public void setBindUser(LocalUser bindUser) {
		this.bindUser = bindUser;
	}

	public Integer getFlag() {
		return flag;
	}

	public void setFlag(Integer flag) {
		this.flag = flag;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getRelevanceId() {
		return relevanceId;
	}

	public void setRelevanceId(String relevanceId) {
		this.relevanceId = relevanceId;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPosition() {
		return position;
	}

	public void setPosition(String position) {
		this.position = position;
	}

	public RTXUserBean(){
		this.id = nextId++;
	}

	public static void cleanId() {
		nextId = 0;
	}

	public void addUserDept(RTXDeptBean rtxDept) {
		if (!userDepts.contains(rtxDept)){
			userDepts.add(rtxDept);
		}
	}
	
	public boolean affiliatedWithDepart(RTXDeptBean depart) {
		boolean result = userDepts.contains(depart);
		
		return result;
	}

}
